<template>
  <div class="staging">
    <div class="box">
      <a-tabs :tabBarStyle="{ margin: 0 }" @change="tabs.callback" :activeKey="tabs.active()">
        <a-tab-pane v-for="item in tabs.items" :tab="item.title" :key="item.key"> </a-tab-pane>
      </a-tabs>
    </div>
    <div>
      <router-view />
    </div>
  </div>
</template>

<script>
import Box from '@/views/xlgc/Box/index'
export default {
  name: 'Index',
  components: { Box },
  data() {
    return {
      tabs: {
        items: [
          {
            key: '1',
            title: '全部'
          },
          {
            key: '2',
            title: '待办任务'
          },
          {
            key: '3',
            title: '已完成'
          }
        ],
        active: () => {
          switch (this.$route.path) {
            case '/all/list':
              return '1'
            case '/backlog/list':
              return '2'
            case '/accomplish/list':
              return '3'
          }
        },
        callback: key => {
          switch (key) {
            case '1':
              this.$router.push('/all/list')
              break
            case '2':
              this.$router.push('/backlog/list')
              break
            case '3':
              this.$router.push('/accomplish/list')
              break
          }
        }
      },
      search: true,
      tabStatus: 'addTab'
    }
  }
}
</script>

<style scoped>
.box{
  width: 100%;
  /*height: 100px;*/
  background-color: white;
  box-sizing: border-box;
  /*margin: 20px;*/
  margin: -15px 0;
  border-radius: .2rem;
  /*box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);*/
  padding: 5px 15px;
  position: relative;
  top: 17px;
}
</style>
